/**
 * @license
 * Copyright Akveo. All Rights Reserved.
 * Licensed under the MIT License. See License.txt in the project root for license information.
 */

@mixin nb-toggle-theme() {
  nb-toggle {
    .toggle {
      height: nb-theme(toggle-height);
      width: nb-theme(toggle-width);
      background-color: nb-theme(toggle-background-color);
      border: nb-theme(toggle-border-width) solid nb-theme(toggle-border-color);
      border-radius: nb-theme(toggle-border-radius);
      cursor: nb-theme(toggle-cursor);
    }

    .toggle.checked {
      background-color: nb-theme(toggle-primary-checked-background-color);
      border-color: nb-theme(toggle-primary-checked-border-color);
    }

    .native-input {
      &:focus + .toggle {
        border-color: nb-theme(toggle-primary-focus-border-color);
        box-shadow: 0 0 0 nb-theme(toggle-outline-width) nb-theme(toggle-outline-color);
      }

      &:active + .toggle {
        background-color: nb-theme(toggle-primary-active-background-color);
        border-color: nb-theme(toggle-primary-active-border-color);
      }
    }

    .toggle:hover {
      background-color: nb-theme(toggle-primary-hover-background-color);
      border-color: nb-theme(toggle-primary-hover-border-color);
    }

    .native-input:disabled {
      & + .toggle {
        background-color: nb-theme(toggle-disabled-background-color);
        border-color: nb-theme(toggle-disabled-border-color);
        cursor: nb-theme(toggle-disabled-cursor);

        nb-icon {
          color: nb-theme(toggle-disabled-switcher-checkmark-color);
        }
      }

      & ~ .text {
        color: nb-theme(toggle-disabled-text-color);
      }
    }

    .toggle-switcher {
      width: nb-theme(toggle-switcher-size);
      height: nb-theme(toggle-switcher-size);
      background-color: nb-theme(toggle-switcher-background-color);

      nb-icon {
        color: nb-theme(toggle-switcher-checkmark-color);
      }
    }

    .text {
      color: nb-theme(toggle-text-color);
      font-family: nb-theme(toggle-text-font-family);
      font-size: nb-theme(toggle-text-font-size);
      font-weight: nb-theme(toggle-text-font-weight);
      line-height: nb-theme(toggle-text-line-height);
    }
  }

  @each $status in nb-get-statuses() {
    @include nb-toggle-status($status);
  }
}

@mixin nb-toggle-status($status: '') {
  nb-toggle.status-#{$status} {

    .toggle {
      background-color: nb-theme(toggle-#{$status}-background-color);
      border-color: nb-theme(toggle-#{$status}-border-color);
    }

    .toggle.checked {
      background-color: nb-theme(toggle-#{$status}-checked-background-color);
      border-color: nb-theme(toggle-#{$status}-checked-border-color);
    }

    .native-input {
      &:focus + .toggle {
        border-color: nb-theme(toggle-#{$status}-focus-border-color);
      }

      &:active + .toggle {
        background-color: nb-theme(toggle-#{$status}-active-background-color);
        border-color: nb-theme(toggle-#{$status}-active-border-color);
      }
    }

    .toggle:hover {
      background-color: nb-theme(toggle-#{$status}-hover-background-color);
      border-color: nb-theme(toggle-#{$status}-hover-border-color);
    }

    .toggle-switcher {
      nb-icon {
        color: nb-theme(toggle-#{$status}-checked-switcher-checkmark-color);
      }
    }

    .native-input:disabled {
      & + .toggle {
        background-color: nb-theme(toggle-disabled-background-color);
        border-color: nb-theme(toggle-disabled-border-color);

        nb-icon {
          color: nb-theme(toggle-disabled-switcher-checkmark-color);
        }
      }

      & ~ .text {
        color: nb-theme(toggle-disabled-text-color);
      }
    }
  }
}
